home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 3_7.lha / 3_7 / 3_7e.c < prev    next >
Text File  |  1993-08-08  |  345b  |  19 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. /  Copy the string s2 into s1.
  6. /  Version 2
  7. oid strncpy(char *s1, int maxlen, const char *s2)
  8.  
  9.    if (s1 && s2)
  10. {
  11. while (--maxlen)
  12.     if (!(*s1++ = *s2++))
  13.     return;
  14.  
  15. if (maxlen > 0)
  16.     *s1 = '\0';
  17. }
  18.  
  19.